package com.youxin.busfoundation.enums;


public class EnumDemo {  
  
    public static void main(String[] args) {  
        Produces produces = Produces.getProduces(425);  
        switch (produces) {  
        case PRODUCT_A:  
            System.out.println("select " + "PRODUCT_A"+",name:"+produces.getName());  
            break;  
        case PRODUCT_B:  
            System.out.println("select " + "PRODUCT_B"+",name:"+produces.getName());  
            break;  
        case PRODUCT_C:  
            System.out.println("select " + "PRODUCT_C"+",name:"+produces.getName());  
            break;  
        case PRODUCT_D:  
            System.out.println("select " + "PRODUCT_D"+",name:"+produces.getName());  
            break;  
        case PRODUCT_E:  
        	System.out.println("select " + "PRODUCT_E"+",name:"+produces.getName());  
        	break;  
        case PRODUCT_F:  
        	System.out.println("select " + "PRODUCT_F"+",name:"+produces.getName());  
        	break;  
        default:  
            System.out.println("select " + "unknow!!");  
            break;  
        }  
    }  
  
    public enum Produces {  
    	PRODUCT_A("500",425), PRODUCT_B("1000",800), PRODUCT_C("2000",1500), PRODUCT_D("5000",3250), PRODUCT_E("5000",1920), PRODUCT_F("5000",3360),PRODUCT_TEST("1",0);
    	
  
    	Produces(String name, int id) {  
            _name = name;  
            _id = id;  
        }  
  
        private String _name;  
        private int _id;  
  
        public String getName() {  
            return _name;  
        }  
  
        public int getId() {  
            return _id;  
        }  
  
        public static Produces getProduces(int num) {  
            switch (num) {  
            case 425:  
                return Produces.PRODUCT_A;  
            case 800:  
                return Produces.PRODUCT_B;  
            case 1500:  
                return Produces.PRODUCT_C;  
            case 3250:  
                return Produces.PRODUCT_D;  
            case 1920:  
            	return Produces.PRODUCT_E;  
            case 3360:  
            	return Produces.PRODUCT_F;  
            }
			return Produces.PRODUCT_TEST;  
        }  
    }  
}  
